$(document).ready(function() {
var counter = 2;
		
			////////////////////////////////////
		
		
		
		
		
		
	    $("#addButton").click(function () {
		
			if(counter>10){
		        alert("Only 10 textboxes allow");
		        return false;
		    }  
			 
			var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counter);
 //edit name and id to textbox[];
 newTextBoxDiv.html('<label>Mail Adresi # '+ counter + ': </label>' +
       '<input type="text" name="textbox['+counter+']" ' + ' id="textbox['+ counter +']" />');
 
 newTextBoxDiv.appendTo("#TextBoxesGroup");
			
				
		    counter++;
	    });

	    $("#removeButton").click(function () {
		    if(counter==1){
		        alert("No more textbox to remove");
		        return false;
		    }   
	        counter--;
			
	        $("#TextBoxDiv" + counter).remove();
		});
		
		$("#getButtonValue").click(function () {
		
			var msg = '';
			for(i=1; i<counter; i++){
			msg += "\n Textbox[" + i + "] : " + $('#textbox[' + i +']').val();
				
				
			}
		   	alert(msg);
		});
		
});

// JavaScript Document